/*********************************************************
          File Name:9.18.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon 14 Sep 2015 07:49:01 PM CST
**********************************************************/

#include <iostream>
#include <deque>
#include <string>
#include <list>

using namespace std;

void fun()
{
        deque<string> ds;
        string s;

        while(getline(cin, s))
        {
                ds.push_front(s);
        }

        for(auto &x: ds)
                cout << x << endl;

        cout << "\e[35m++++print by using iterator+++\e[0m\n";

        for(auto it = ds.begin(); it != ds.end(); ++it)
                cout << *it << endl;
}

int main()
{
        cout << unitbuf;
        cout << "using `deque`\n";
        fun();
        cout << "using `list`\n";

        cin.clear();    // clear eof bit

        list<string> ls;

        for(string s; cin >> s; ls.push_front(s));
        for(decltype(ls.begin()) it = ls.begin(); it != ls.end(); ++it)
                cout << *it << endl;
        return 0;
}
